
import request from '@/utils/request'
import { queryFormart } from '@/utils/queryFormart.js'

const userApi = {
  treeList: '/people-count/config/monitor/treeList',
  searchEquByLogic: '/people-count/config/equ/searchEquByLogic',
  getAreaLog: '/people-count/area/log/getAreaLog',
  getAreaData: '/people-analysis/analysis/monitor/getAreaData',
  getAreaDateBymonthOrYear: '/people-analysis/analysis/monitor/getAreaDateBymonthOrYear',
  getVideoUrl: '/people-service/device/service/getUrl',
  windowControl: '/people-service/device/service/windowControl'
}

export function treeList (parameter) {
  return request({
    url: userApi.treeList,
    method: 'post',
    data: parameter
  })
}
export function searchEquByLogic (parameter) {
  console.log(parameter)
  return request({
    url: userApi.searchEquByLogic,
    method: 'get',
    params: parameter
  })
}
export function getAreaLog (parameter) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: userApi.getAreaLog,
    method: 'post',
    data: queryFormart(parameter)
  })
}

// 区域人数变化趋势
export function getAreaData (parameter) {
  return request({
    // headers: {
    //     'Content-Type': 'application/x-www-form-urlencoded'
    // },
    url: userApi.getAreaData,
    method: 'post',
    // data: queryFormart(parameter)
    data: parameter
  })
}

// 区域人数变化趋势-年月
export function getAreaDateBymonthOrYear (parameter) {
  return request({
    // headers: {
    //     'Content-Type': 'application/x-www-form-urlencoded'
    // },
    url: userApi.getAreaDateBymonthOrYear,
    method: 'post',
    // data: queryFormart(parameter)
    data: parameter
  })
}
export function getVideoUrl (parameter) {
  return request({
    url: userApi.getVideoUrl,
    method: 'get',
    params: parameter
  })
}

export function windowControl (parameter) {
  return request({
    url: userApi.windowControl,
    method: 'post',
    data: parameter
  })
}

// 太子湾 - 开始计算
export function tzwPic (url, name) {
  return request({
    url: `/people-count/drone/tzw/pic?url=${url}&name=${name}`,
    method: 'post'
  })
}

// 太子湾 - 图片列表
export function tzwList (pageNo, pageSize) {
  return request({
    url: `/people-count/drone/tzw/list?pageNum=${pageNo}&pageSize=${pageSize}`,
    method: 'get'
  })
}

// 太子湾 - 删除记录
export function droneTzw (id) {
  return request({
    url: `/people-count/drone/tzw/${id}`,
    method: 'DELETE'
  })
}
